<template>
  <div>
    <button v-google-signin-button="clientId" class="google-signin-button"> Continue with Google</button>
  </div>
 </template>
 
 <script>
   export default {
     data: () => ({
       clientId: 'my.apps.googleusercontent.com'
     }),
     methods: {
       OnGoogleAuthSuccess (idToken) {
        console.log("token:",idToken) //返回第三方结果信息 默认是全token 要用jsonwebtoken 解析
        const payload = idToken.split('.')[1]; // 获取JWT的负载部分
        const decodedPayload = JSON.parse(atob(payload));
        console.log("token 解析:",decodedPayload);

         // Receive the idToken and make your magic with the backend
       },
       OnGoogleAuthFail (error) {
        console.log("error")
        console.log(error)
       }
     }
   }
 </script>
 
 <style>
   .google-signin-button {
     color: white;
     background-color: #000;
     height: 40px;
     text-align: center;
   }
 </style>